import time

from appium.webdriver.common.appiumby import By


def buy_now_Payment(driver):
    # 点击商品进入商品详情页
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/product_pic_img").click()
    time.sleep(3)
    # 点击立即购买
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/promptly_buy_tv").click()
    # 商品数量的变化,加1
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/cart_plus_btn").click()
    # 点击确定
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/confirm_tv").click()
    # 选择收货地址
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/order_address_tv").click()
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/address_detail_tv").click()
    # 点击使用积分
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/score_check_iv").click()
    # 点击提交订单
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/submit_tv").click()
    # 点击立即支付
    driver.find_element(by=By.ID, value="com.tpshop.malls:id/pay_btn").click()

